# ==================================
#
#  Code for replicating:
# "Positioning Under Alternative Electoral Systems: Evidence From Japanese Candidate Election Manifestos"
#  Amy Catalinac, NYU
#
# ==================================










# ==================================
# Dispersion within the LDP
# (Figure 9 in Appendix)

data <- read.csv(file="dispersion_in_parties.csv")
ldp.data <- data[data$pty=="ldp",]
ldp.data$var

years <- c(1986, 1990, 1993, 1996, 2000, 2003, 2005, 2009)
par(mfrow = c(1, 1), mar = c(4,4,2,1), tcl = -0.25, mgp = c(1.75, 0.6, 0),
    font.main = 1, cex.main = 2)
plot(years, ldp.data$var, pch=19, ylim=c(0,0.9), 
     ylab="Dispersion in Candidate Positions Within LDP", xlab="Year", xaxt="n", cex.lab=1.5)
axis(1, at=c(1986, 1990, 1993, 1996, 2000, 2003, 2005, 2009), cex.axis=1.5)
lines(years, ldp.data$var, lwd =2)
arrows(1986, ldp.data[1,4], 1986, ldp.data[1,5], code = 3, lwd=1, angle=90)
arrows(1990, ldp.data[2,4], 1990, ldp.data[2,5], code = 3, lwd=1, angle=90)
arrows(1993, ldp.data[3,4], 1993, ldp.data[3,5], code = 3, lwd=1, angle=90)
arrows(1996, ldp.data[4,4], 1996, ldp.data[4,5], code = 3, lwd=1, angle=90)
arrows(2000, ldp.data[5,4], 2000, ldp.data[5,5], code = 3, lwd=1, angle=90)
arrows(2003, ldp.data[6,4], 2003, ldp.data[6,5], code = 3, lwd=1, angle=90)
arrows(2005, ldp.data[7,4], 2005, ldp.data[7,5], code = 3, lwd=1, angle=90)
arrows(2009, ldp.data[8,4], 2009, ldp.data[8,5], code = 3, lwd=1, angle=90)

arrows(1996, 0.8, 1996, 0.2, lwd=3, col = "black")
text(x=2000.6, y=0.85, labels="First Election Under MMM", cex=2, xpd=NA, pos=2, col = "black")

rm(list=ls())







